package org.example.util;


import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码生成器 - 用于生成BCrypt加密密码
 */
public class PasswordGenerator {
    
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        String password1 = "123456";
        String password2 = "admin123";
        
        System.out.println("=== BCrypt密码加密结果 ===");
        System.out.println("原始密码: " + password1);
        System.out.println("加密后: " + encoder.encode(password1));
        System.out.println();
        System.out.println("原始密码: " + password2);
        System.out.println("加密后: " + encoder.encode(password2));
        System.out.println();
        
        // 验证示例
        String encoded1 = encoder.encode(password1);
        System.out.println("验证密码 '" + password1 + "': " + encoder.matches(password1, encoded1));
        System.out.println("验证错误密码: " + encoder.matches("wrong", encoded1));
    }
} 